package com.monitor.tasks;

import com.monitor.pubInter.exception.SkException;
import com.monitor.service.IDeptService;
import com.monitor.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;


// 部门和员工相关信息
@Configuration
@EnableScheduling
@Slf4j
public class DeptAndUserTask {
    @Autowired
    private IDeptService deptService;
    @Autowired
    private IUserService userService;
    @Scheduled(cron = "${task.queryDeptAndUserCron}")
    public void squeryDeptAndUserWork() throws SkException {
        deptService.fetchAndUpdateDeptAndUser();
        userService.updateNoIdUser();
    }
}
